<?php
  require_once("includes/config.php"); 
  if($_SERVER["REQUEST_METHOD"] == "POST")
  {
    /*if(!empty($_POST['company_id']))
      $client_id = $_POST['company_id'];
    else
      $client_id = $_POST['client_id'];*/
      
    $result = query("UPDATE payment_vouchers SET recipient = ?, amount = ?,reason = ? ,paymen_method = ? ,notes = ? ,miladi_date = ? ,Hijri_date = ? WHERE payment_id = ?"
    
    ,$_POST['recipient'],$_POST['amount'],$_POST['reason'],$_POST['type'],$_POST['notes'],$_POST['date'],$_POST['hijri-date'],$_POST['payment_id']);
    
    $_SESSION['success_message'] = "تم التعديل بنجاح";
                
    $updatePaid = query("UPDATE contracts SET paid_back = paid_back + ? where contract_id = ? ",$_POST['amount'], $_POST['contract_id']);
    redirect("payment_vouchers.php");   
  }
	?>